# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ovos-core
pkgver=0.0.8a24
pkgrel=0
pkgdesc="OVOS Core, the OVOS Artificial Intelligence platform"
url="https://github.com/OpenVoiceOS/ovos-core/"
# s390x blocked by py3-speechrecognition -> py3-ovos-backend-client
arch="noarch !s390x"
license="Apache-2.0"
depends="
	py3-adapt-parser
	py3-combo-lock
	py3-dateutil
	py3-lingua-franca
	py3-ovos-backend-client
	py3-ovos-bus-client
	py3-ovos-classifiers
	py3-ovos-config
	py3-ovos-plugin-manager
	py3-ovos-utils
	py3-ovos-workshop
	py3-padatious
	py3-requests
	py3-watchdog
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenVoiceOS/ovos-core/archive/refs/tags/V$pkgver.tar.gz
	profile.sh
	ovos.conf
	"
# Net is required for tests
# Some tests are broken still, will be enabled later
options="!check"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# test_hotword_factory and test_local_recognizer fail
	# https://github.com/MycroftAI/mycroft-core/issues/2574
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 -t "$pkgdir"/etc/OpenVoiceOS "$srcdir"/ovos.conf

	install -Dm644 "$srcdir"/profile.sh "$pkgdir"/etc/profile.d/ovos.sh
}
sha512sums="
c0e7bbad76b5de655ed4d14ce4b84d4a7061f34de3aebc2335f8b14b08eae5ef4090e05ca81444249d3818ff2e1caa9bb9289753fbb17b663e9cd094a7a0458e  ovos-core-0.0.8a24.tar.gz
c3d1a605a0b574c8e2c4031f592bdbf023f5ed9b2e1ba0cea38cf79278331f245dbe4e220e7f81de73fe612ffd722253805058dae04ba89c3d01c361b329e4ef  profile.sh
889b668be450db9c27d7d9f3b00bbcd9a2882f8a4c129cdc5c94ab21490e85acddfd914496447f5f011713c2ecd5b1cafbf13a5948677d9ff82eb5e478faf47a  ovos.conf
"
